<html>
<head>
    <script>
        function pressTabKey()
        {
            if (window.eventSender)
                eventSender.keyDown("\t");
        }

        function test() {
            if (window.testRunner)
                testRunner.dumpAsText();

            var before = document.getElementById("before");
            var area = document.getElementById("area");

            before.focus();
            pressTabKey();

            if (document.activeElement == area)
                res.innerHTML = "Test Passed";
        }
    </script>
</head>

<body onload="test()">
    This tests that pressing Tab focuses areas in an image map even if they're not direct children.

    <div id="res">Test Failed</div>

    <div id="before" tabIndex=0 />

    <div>
        <map name="imagemap">
            <div>
                <area id="area" shape="rect" coords="0,0,128,128" href="#dummy" />
            </div>
        </map>
        <img width="128" height="128" usemap="#imagemap" ismap />
    </div>

    <div id="after" tabIndex=0 />

</body>
</head>
</html>
